package com.ticket;

import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.util.Scanner;

public class tryit {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        int a=scanner.nextInt();
////        System.out.println(a);
//    }
public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);




    InputStream resourceAsStream = BuyTicket.class.getClassLoader().getResourceAsStream("jdbc.properties");
    Properties properties = new Properties();
    try {
        properties.load(resourceAsStream);
        String driverClass = properties.getProperty("driverClass");
        String url = properties.getProperty("url");
        String usesr = properties.getProperty("user");
        String password = properties.getProperty("password");
        Class.forName(driverClass);
        Connection connection = DriverManager.getConnection(url, usesr, password);
        Statement statement = connection.createStatement();
        String sql="select *  from aa";
        ResultSet resultSet = statement.executeQuery(sql);
        while (resultSet.next()){
//            String name = resultSet.getString("name");
//            String date = resultSet.getString("date");
//            String address = resultSet.getString("address");
            int id=resultSet.getInt("id");
            int number = resultSet.getInt("number");
            int last = resultSet.getInt("last");
            System.out.println(id+"\t"+number+"\t"+last+"\t");


        }
        System.out.println("请输入你所需要观看的场次：");
        int chose= scanner.nextInt();
        String sql1="select *from concert where id="+chose;
        System.out.println(sql1);

    } catch (Exception e) {
//        throw new Exception(e);
        System.out.println("出现异常");
    }
}
}
